<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="/WEB-INF/template.xhtml">
	<ui:define name="title">Privileges</ui:define>
	<ui:define name="body">
		<p>Configure the administrator privileges via this page.</p>
		<h:form>
			<rich:extendedDataTable var="row" value="#{${admin-control-cdi-components-prefix}AdminList}"
				binding="#{${admin-control-cdi-components-prefix}PrivilegesController.dataTable}" rows="10">
				<rich:column>
					<f:facet name="header">
						<h:outputText value="Name" />
					</f:facet>
					<h:outputText value="#{row.name}" />
				</rich:column>
				<rich:column>
					<f:facet name="header">
						<h:outputText value="Card Number" />
					</f:facet>
					<h:outputText value="#{row.cardNumber}" />
				</rich:column>
				<rich:column>
					<f:facet name="header">
						<h:outputText value="Pending" />
					</f:facet>
					<h:outputText value="#{row.pending}" />
				</rich:column>
				<rich:column>
					<f:facet name="header">
						<h:outputText value="Actions" />
					</f:facet>
					<h:commandLink value="Delete"
						action="#{${admin-control-cdi-components-prefix}PrivilegesController.delete}"
						onclick="return askDeleteQuestion()" />
					<h:outputText value=" " />
					<h:commandLink value="Approve"
						action="#{${admin-control-cdi-components-prefix}PrivilegesController.approve}"
						rendered="#{row.pending}" />
				</rich:column>
				<f:facet name="footer">
					<rich:dataScroller />
				</f:facet>
			</rich:extendedDataTable>
			<script type="text/javascript">
				function askDeleteQuestion() {
					var agree = confirm("Remove Administrator?");
					if (agree) {
						return true;
					} else {
						return false;
					}
				}
        	</script>
		</h:form>
	</ui:define>
</ui:composition>
</html>